fn select_sort(a: &mut Vec<i32>) {
    let mut i = 0;
    loop  {
        if i >= a.len() {
            break;
        }
        let mut j = i;
        let mut index = i;
        loop {
            if j >= a.len() {
                break;
            }
            if a[j] < a[index] {
                index = j;
            }
            j += 1;
        }
        if index != i {
            a.swap(index, i);
        }
        i = i + 1;
    }
}

#[test]
fn test_select() {
    let mut a = vec![1, 9, 8];
    select_sort(&mut a);
    assert_eq!(a[0], 1);
}
